package cn.autumnorange.app.user.consumer.authorization.security.security;

import lombok.extern.slf4j.Slf4j;
import org.springframework.security.web.session.SessionInformationExpiredEvent;
import org.springframework.security.web.session.SessionInformationExpiredStrategy;
import org.springframework.stereotype.Component;

import javax.servlet.ServletException;
import java.io.IOException;

@Component
@Slf4j
public class MerryyounExpiredSessionStrategy implements SessionInformationExpiredStrategy {
  @Override
  public void onExpiredSessionDetected(SessionInformationExpiredEvent eventØ)
      throws IOException, ServletException {
    eventØ.getResponse().setContentType("application/json;charset=UTF-8");
    eventØ.getResponse().getWriter().write("并发登录!");
  }
}
